package org.sea.mybator.model;

import java.util.LinkedHashMap;
import java.util.Map;

public class QueryBean {

    private Map<String, Object> f = new LinkedHashMap<String, Object>();
    
    private int pageNo = 1;

    private int pageRows = 20;

    private int totalCount = 0;
    
    
    public int getBeginCount() {
        int beginCount = (getPageNo() - 1) * this.pageRows;
        if (beginCount >= getTotalCount()) {
            int modpageSize = getTotalCount() % this.pageRows;
            if (modpageSize == 0) {
                modpageSize = this.pageRows;
            }
            beginCount = getTotalCount() + 1 - modpageSize;
        }
        return beginCount < 0 ? 0 : beginCount;
    }

    public int getPageRows() {
        return this.pageRows;
    }

    public void setPageRows(int pageRows) {
        this.pageRows = pageRows;
    }

    public int getTotalCount() {
        return this.totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageNo() {
        if (this.pageNo < 1) {
            this.pageNo = 1;
        }

        return this.pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }
     
    public Map<String, Object> getF() {
        return this.f;
    }

    public void setF(Map<String, Object> f) {
        this.f = f;
    }
}
